package vn.fpt.fsoft.entities;




import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * @author DuongPV1
 * Entity TrustRegion mapping with TrustRegion table 
 * */
@Entity
@Table(name="TrustRegion")
public class TrustRegion implements java.io.Serializable {

	private int trustRegionId;
	private Nation nation;
	private String name;
	private String description;
	private Set<TrustDistrict> trustDistricts = new HashSet<TrustDistrict>(0); 
	public TrustRegion() {
		// TODO Auto-generated constructor stub
	}
	
	/**
	 * @param trustRegionId
	 * @param nation
	 * @param name
	 * @param description
	 * @param trustDistricts
	 */
	public TrustRegion(int trustRegionId, Nation nation, String name,
			String description, Set<TrustDistrict> trustDistricts) {
		super();
		this.trustRegionId = trustRegionId;
		this.nation = nation;
		this.name = name;
		this.description = description;
		this.trustDistricts = trustDistricts;
	}
	@Id
	@GeneratedValue
	@Column(name="TrustRegionId",nullable=false,unique=true)
	public int getTrustRegionId() {
		return trustRegionId;
	}
	public void setTrustRegionId(int trustRegionId) {
		this.trustRegionId = trustRegionId;
	}
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="NationId")
	public Nation getNation() {
		return nation;
	}
	public void setNation(Nation nation) {
		this.nation = nation;
	}
	@Column(name="Name")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(name="Description")
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	@OneToMany(fetch=FetchType.LAZY,mappedBy="trustRegion")	
	public Set<TrustDistrict> getTrustDistricts() {
		return trustDistricts;
	}
	public void setTrustDistricts(Set<TrustDistrict> trustDistricts) {
		this.trustDistricts = trustDistricts;
	}

	

}
